<template>
  <div>
    <div id="BeautifulChart"></div>
  </div>
</template>

<script>
export default {
  name: "BeautifulChart",
  data() {
    return {
    };
  },
  created() {},
  methods: {
    beautifulChart: function() {
      const beautifulChart = this.$echarts.init(
        document.getElementById("BeautifulChart")
      );

      beautifulChart.setOption({
        tooltip: {
          formatter: "{a} <br/>{b} : {c}%"
        },
        toolbox: {
          feature: {
            restore: {},
            saveAsImage: {}
          }
        },
        series: [
          {
            name: "业务指标",
            type: "gauge",
            detail: { formatter: "{value}%" },
            data: [
              {
                value: (Math.random() * 100).toFixed(2) - 0,
                name: "完成率"
              }
            ]
          }
        ]
      })
    }
  },
  mounted() {
    this.beautifulChart();
  }
};
</script>

<style scoped>
#BeautifulChart {
  height: 75vh;
}
</style>